/*
 * @Author: AiLjx
 * @Date: 2023-03-08 11:36:53
 * @LastEditors: AiLjx
 * @LastEditTime: 2023-03-08 19:41:34
 */
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    proxy: {
      '/video-scrolling/api': {
        target: 'https://bdb24c6d-8c19-4f80-8e7e-c9c9f037f131.bspapp.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/video-scrolling\/api/, '') // 不可以省略rewrite
      }
    }
  },
  base: '/video-scrolling/'
})
